package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (电子券)TB_ElectronicTicket
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_ElectronicTicket#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_electronicTicket")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("电子券")
@com.lianjing.sh.processing.info.annotation.InfoComment("电子券")
public class TB_ElectronicTicket
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	com.sh_lianjing.state.HasStatable,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 卡号 */
		public String getNumber();
		/** 状态 */
		public bairui.international.model.status.State_ElectronicTicket getState();
		/** 电子券单 */
		public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder getElectronicTicketOrder();
		/** 转送次数 */
		public Integer getTransmitCount();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_ElectronicTicket properties(MustProperties properties) {
		this.setNumber(properties.getNumber());
		this.setState(properties.getState());
		this.setElectronicTicketOrder(properties.getElectronicTicketOrder());
		this.setTransmitCount(properties.getTransmitCount());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_ElectronicTicket(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 接受分配用户 */
		public bairui.international.model.domain.jpa.TB_User getAssignedUser();
		/** 领取者 */
		public bairui.international.model.domain.jpa.TB_User getTakor();
		/** 分配时间 */
		public java.util.Date getAssignDate();
		/** 领取时间 */
		public java.util.Date getTakeDate();
		/** 使用时间 */
		public java.util.Date getUseDate();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 二维码 */
		public String getDimensionalUrl();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_ElectronicTicket properties(OptionalSingleProperties properties) {
		this.setAssignedUser(properties.getAssignedUser());
		this.setTakor(properties.getTakor());
		this.setAssignDate(properties.getAssignDate());
		this.setTakeDate(properties.getTakeDate());
		this.setUseDate(properties.getUseDate());
		this.setProductOrder(properties.getProductOrder());
		this.setDimensionalUrl(properties.getDimensionalUrl());
		return this;
	}
	
	
	
	public TB_ElectronicTicket(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 卡号 */
		public String getNumber();
		/** 状态 */
		public bairui.international.model.status.State_ElectronicTicket getState();
		/** 电子券单 */
		public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder getElectronicTicketOrder();
		/** 转送次数 */
		public Integer getTransmitCount();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_ElectronicTicket properties(CurrentMustProperties properties) {
		this.setNumber(properties.getNumber());
		this.setState(properties.getState());
		this.setElectronicTicketOrder(properties.getElectronicTicketOrder());
		this.setTransmitCount(properties.getTransmitCount());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 接受分配用户 */
		public bairui.international.model.domain.jpa.TB_User getAssignedUser();
		/** 领取者 */
		public bairui.international.model.domain.jpa.TB_User getTakor();
		/** 分配时间 */
		public java.util.Date getAssignDate();
		/** 领取时间 */
		public java.util.Date getTakeDate();
		/** 使用时间 */
		public java.util.Date getUseDate();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 二维码 */
		public String getDimensionalUrl();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_ElectronicTicket properties(CurrentOptionalSingleProperties properties) {
		this.setAssignedUser(properties.getAssignedUser());
		this.setTakor(properties.getTakor());
		this.setAssignDate(properties.getAssignDate());
		this.setTakeDate(properties.getTakeDate());
		this.setUseDate(properties.getUseDate());
		this.setProductOrder(properties.getProductOrder());
		this.setDimensionalUrl(properties.getDimensionalUrl());
		return this;
	}
	
	public TB_ElectronicTicket(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_ElectronicTicket(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_ElectronicTicket update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_ElectronicTicket.this);
			if(isOverride_getOrderValue){
				TB_ElectronicTicket.this.setOrderValue(orderValue);
			}
	
			String number = getNumber(TB_ElectronicTicket.this);
			if(isOverride_getNumber){
				TB_ElectronicTicket.this.setNumber(number);
			}
	
			bairui.international.model.status.State_ElectronicTicket state = getState(TB_ElectronicTicket.this);
			if(isOverride_getState){
				TB_ElectronicTicket.this.setState(state);
			}
	
			bairui.international.model.domain.jpa.TB_ElectronicTicketOrder electronicTicketOrder = getElectronicTicketOrder(TB_ElectronicTicket.this);
			if(isOverride_getElectronicTicketOrder){
				TB_ElectronicTicket.this.setElectronicTicketOrder(electronicTicketOrder);
			}
	
			bairui.international.model.domain.jpa.TB_User assignedUser = getAssignedUser(TB_ElectronicTicket.this);
			if(isOverride_getAssignedUser){
				TB_ElectronicTicket.this.setAssignedUser(assignedUser);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentRecords = getElectronicTicketPresentRecords(TB_ElectronicTicket.this);
			if(isOverride_getElectronicTicketPresentRecords){
				TB_ElectronicTicket.this.setElectronicTicketPresentRecords(electronicTicketPresentRecords);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord> electronicTicketStateRecords = getElectronicTicketStateRecords(TB_ElectronicTicket.this);
			if(isOverride_getElectronicTicketStateRecords){
				TB_ElectronicTicket.this.setElectronicTicketStateRecords(electronicTicketStateRecords);
			}
	
			bairui.international.model.domain.jpa.TB_User takor = getTakor(TB_ElectronicTicket.this);
			if(isOverride_getTakor){
				TB_ElectronicTicket.this.setTakor(takor);
			}
	
			java.util.Date assignDate = getAssignDate(TB_ElectronicTicket.this);
			if(isOverride_getAssignDate){
				TB_ElectronicTicket.this.setAssignDate(assignDate);
			}
	
			java.util.Date takeDate = getTakeDate(TB_ElectronicTicket.this);
			if(isOverride_getTakeDate){
				TB_ElectronicTicket.this.setTakeDate(takeDate);
			}
	
			java.util.Date useDate = getUseDate(TB_ElectronicTicket.this);
			if(isOverride_getUseDate){
				TB_ElectronicTicket.this.setUseDate(useDate);
			}
	
			Integer transmitCount = getTransmitCount(TB_ElectronicTicket.this);
			if(isOverride_getTransmitCount){
				TB_ElectronicTicket.this.setTransmitCount(transmitCount);
			}
	
			bairui.international.model.domain.jpa.TB_ProductOrder productOrder = getProductOrder(TB_ElectronicTicket.this);
			if(isOverride_getProductOrder){
				TB_ElectronicTicket.this.setProductOrder(productOrder);
			}
	
			String dimensionalUrl = getDimensionalUrl(TB_ElectronicTicket.this);
			if(isOverride_getDimensionalUrl){
				TB_ElectronicTicket.this.setDimensionalUrl(dimensionalUrl);
			}
		}
	
		public TB_ElectronicTicket up(){
			return TB_ElectronicTicket.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_ElectronicTicket it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 卡号 */
		private boolean isOverride_getNumber = true;
		public String getNumber(TB_ElectronicTicket it) throws Exception { 
			isOverride_getNumber = false; 
			return null;
		}
		/** 状态 */
		private boolean isOverride_getState = true;
		public bairui.international.model.status.State_ElectronicTicket getState(TB_ElectronicTicket it) throws Exception { 
			isOverride_getState = false; 
			return null;
		}
		/** 电子券单 */
		private boolean isOverride_getElectronicTicketOrder = true;
		public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder getElectronicTicketOrder(TB_ElectronicTicket it) throws Exception { 
			isOverride_getElectronicTicketOrder = false; 
			return null;
		}
		/** 接受分配用户 */
		private boolean isOverride_getAssignedUser = true;
		public bairui.international.model.domain.jpa.TB_User getAssignedUser(TB_ElectronicTicket it) throws Exception { 
			isOverride_getAssignedUser = false; 
			return null;
		}
		/** 电子券赠送记录 */
		private boolean isOverride_getElectronicTicketPresentRecords = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> getElectronicTicketPresentRecords(TB_ElectronicTicket it) throws Exception { 
			isOverride_getElectronicTicketPresentRecords = false; 
			return null;
		}
		/** 电子券状态 */
		private boolean isOverride_getElectronicTicketStateRecords = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord> getElectronicTicketStateRecords(TB_ElectronicTicket it) throws Exception { 
			isOverride_getElectronicTicketStateRecords = false; 
			return null;
		}
		/** 领取者 */
		private boolean isOverride_getTakor = true;
		public bairui.international.model.domain.jpa.TB_User getTakor(TB_ElectronicTicket it) throws Exception { 
			isOverride_getTakor = false; 
			return null;
		}
		/** 分配时间 */
		private boolean isOverride_getAssignDate = true;
		public java.util.Date getAssignDate(TB_ElectronicTicket it) throws Exception { 
			isOverride_getAssignDate = false; 
			return null;
		}
		/** 领取时间 */
		private boolean isOverride_getTakeDate = true;
		public java.util.Date getTakeDate(TB_ElectronicTicket it) throws Exception { 
			isOverride_getTakeDate = false; 
			return null;
		}
		/** 使用时间 */
		private boolean isOverride_getUseDate = true;
		public java.util.Date getUseDate(TB_ElectronicTicket it) throws Exception { 
			isOverride_getUseDate = false; 
			return null;
		}
		/** 转送次数 */
		private boolean isOverride_getTransmitCount = true;
		public Integer getTransmitCount(TB_ElectronicTicket it) throws Exception { 
			isOverride_getTransmitCount = false; 
			return null;
		}
		/** 产品订单 */
		private boolean isOverride_getProductOrder = true;
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder(TB_ElectronicTicket it) throws Exception { 
			isOverride_getProductOrder = false; 
			return null;
		}
		/** 二维码 */
		private boolean isOverride_getDimensionalUrl = true;
		public String getDimensionalUrl(TB_ElectronicTicket it) throws Exception { 
			isOverride_getDimensionalUrl = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_ElectronicTicket() {
	}
	
	public TB_ElectronicTicket(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_ElectronicTicket(
		@lombok.NonNull TB_ElectronicTicket bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setNumber(bean.getNumber());
		this.setState(bean.getState());
		this.setElectronicTicketOrder(bean.getElectronicTicketOrder());
		this.setAssignedUser(bean.getAssignedUser());
		this.setElectronicTicketPresentRecords(bean.getElectronicTicketPresentRecords());
		this.setElectronicTicketStateRecords(bean.getElectronicTicketStateRecords());
		this.setTakor(bean.getTakor());
		this.setAssignDate(bean.getAssignDate());
		this.setTakeDate(bean.getTakeDate());
		this.setUseDate(bean.getUseDate());
		this.setTransmitCount(bean.getTransmitCount());
		this.setProductOrder(bean.getProductOrder());
		this.setDimensionalUrl(bean.getDimensionalUrl());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("卡号")
	@com.lianjing.sh.processing.info.annotation.InfoComment("卡号")
	@javax.persistence.Column(name="number", unique=true, nullable=false, length=32)
	private String number;

	@com.lianjing.sh.model.common.annotation.Comment("状态")
	@com.lianjing.sh.processing.info.annotation.InfoComment("状态")
	@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
	@javax.persistence.Column(name="state", nullable=false)
	private bairui.international.model.status.State_ElectronicTicket state;

	@com.lianjing.sh.model.common.annotation.Comment("电子券单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电子券单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ElectronicTicketOrder electronicTicketOrder;

	@com.lianjing.sh.model.common.annotation.Comment("接受分配用户")
	@com.lianjing.sh.processing.info.annotation.InfoComment("接受分配用户")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_User assignedUser;

	@com.lianjing.sh.model.common.annotation.Comment("电子券赠送记录")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电子券赠送记录")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="electronicTicket")
	private java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentRecords;

	@com.lianjing.sh.model.common.annotation.Comment("电子券状态")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电子券状态")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="electronicTicket")
	private java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord> electronicTicketStateRecords;

	@com.lianjing.sh.model.common.annotation.Comment("领取者")
	@com.lianjing.sh.processing.info.annotation.InfoComment("领取者")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_User takor;

	@com.lianjing.sh.model.common.annotation.Comment("分配时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分配时间")
	@javax.persistence.Column(name="assignDate")
	private java.util.Date assignDate;

	@com.lianjing.sh.model.common.annotation.Comment("领取时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("领取时间")
	@javax.persistence.Column(name="takeDate")
	private java.util.Date takeDate;

	@com.lianjing.sh.model.common.annotation.Comment("使用时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("使用时间")
	@javax.persistence.Column(name="useDate")
	private java.util.Date useDate;

	@com.lianjing.sh.model.common.annotation.Comment("转送次数")
	@com.lianjing.sh.processing.info.annotation.InfoComment("转送次数")
	@javax.persistence.Column(name="transmitCount", nullable=false)
	private Integer transmitCount;

	@com.lianjing.sh.model.common.annotation.Comment("产品订单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品订单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne()
	private bairui.international.model.domain.jpa.TB_ProductOrder productOrder;

	@com.lianjing.sh.model.common.annotation.Comment("二维码")
	@com.lianjing.sh.processing.info.annotation.InfoComment("二维码")
	@javax.persistence.Column(name="dimensionalUrl", length=255)
	private String dimensionalUrl;

	/** get[卡号] */
	public String getNumber() {
		return this.number;
	}

	/** get[状态] */
	public bairui.international.model.status.State_ElectronicTicket getState() {
		return this.state;
	}

	/** get[电子券单] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder getElectronicTicketOrder() {
		return this.electronicTicketOrder;
	}

	/** get[接受分配用户] */
	public bairui.international.model.domain.jpa.TB_User getAssignedUser() {
		return this.assignedUser;
	}

	/** get[电子券赠送记录] */
	public java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> getElectronicTicketPresentRecords() {
		return this.electronicTicketPresentRecords;
	}

	/** get[电子券状态] */
	public java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord> getElectronicTicketStateRecords() {
		return this.electronicTicketStateRecords;
	}

	/** get[领取者] */
	public bairui.international.model.domain.jpa.TB_User getTakor() {
		return this.takor;
	}

	/** get[分配时间] */
	public java.util.Date getAssignDate() {
		return this.assignDate;
	}

	/** get[领取时间] */
	public java.util.Date getTakeDate() {
		return this.takeDate;
	}

	/** get[使用时间] */
	public java.util.Date getUseDate() {
		return this.useDate;
	}

	/** get[转送次数] */
	public Integer getTransmitCount() {
		return this.transmitCount;
	}

	/** get[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder() {
		return this.productOrder;
	}

	/** get[二维码] */
	public String getDimensionalUrl() {
		return this.dimensionalUrl;
	}

	/** set[卡号] */
	public void setNumber(String number) {
		this.number = number;
	}

	/** set[状态] */
	public void setState(bairui.international.model.status.State_ElectronicTicket state) {
		this.state = state;
	}

	/** set[电子券单] */
	public void setElectronicTicketOrder(bairui.international.model.domain.jpa.TB_ElectronicTicketOrder electronicTicketOrder) {
		this.electronicTicketOrder = electronicTicketOrder;
	}

	/** set[接受分配用户] */
	public void setAssignedUser(bairui.international.model.domain.jpa.TB_User assignedUser) {
		this.assignedUser = assignedUser;
	}

	/** set[电子券赠送记录] */
	public void setElectronicTicketPresentRecords(java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentRecords) {
		this.electronicTicketPresentRecords = electronicTicketPresentRecords;
	}

	/** set[电子券状态] */
	public void setElectronicTicketStateRecords(java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord> electronicTicketStateRecords) {
		this.electronicTicketStateRecords = electronicTicketStateRecords;
	}

	/** set[领取者] */
	public void setTakor(bairui.international.model.domain.jpa.TB_User takor) {
		this.takor = takor;
	}

	/** set[分配时间] */
	public void setAssignDate(java.util.Date assignDate) {
		this.assignDate = assignDate;
	}

	/** set[领取时间] */
	public void setTakeDate(java.util.Date takeDate) {
		this.takeDate = takeDate;
	}

	/** set[使用时间] */
	public void setUseDate(java.util.Date useDate) {
		this.useDate = useDate;
	}

	/** set[转送次数] */
	public void setTransmitCount(Integer transmitCount) {
		this.transmitCount = transmitCount;
	}

	/** set[产品订单] */
	public void setProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		this.productOrder = productOrder;
	}

	/** set[二维码] */
	public void setDimensionalUrl(String dimensionalUrl) {
		this.dimensionalUrl = dimensionalUrl;
	}

	public void assignElectronicTicketOrder(bairui.international.model.domain.jpa.TB_ElectronicTicketOrder electronicTicketOrder) {
		if(null != electronicTicketOrder){
			electronicTicketOrder.addElectronicTickets(this);
		}
		this.setElectronicTicketOrder(electronicTicketOrder);
	}
	

	public void assignAssignedUser(bairui.international.model.domain.jpa.TB_User assignedUser) {
		if(null != assignedUser){
			assignedUser.addAssignedTickets(this);
		}
		this.setAssignedUser(assignedUser);
	}
	



	public void assignTakor(bairui.international.model.domain.jpa.TB_User takor) {
		if(null != takor){
			takor.addTakedTickets(this);
		}
		this.setTakor(takor);
	}
	

	public void assignProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		if(null != productOrder){
			productOrder.setElectronicTicket(this);
		}
		this.setProductOrder(productOrder);
	}
	

	/** add[ElectronicTicketPresentRecords] */
	public TB_ElectronicTicket addElectronicTicketPresentRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord ... electronicTicketPresentRecords){
		if(this.electronicTicketPresentRecords == null){
			this.electronicTicketPresentRecords = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord bean : electronicTicketPresentRecords){
			bean.setElectronicTicket(this);
			this.electronicTicketPresentRecords.add(bean);
		}
		return this;
	}
	/** add[ElectronicTicketStateRecords] */
	public TB_ElectronicTicket addElectronicTicketStateRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord ... electronicTicketStateRecords){
		if(this.electronicTicketStateRecords == null){
			this.electronicTicketStateRecords = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord bean : electronicTicketStateRecords){
			bean.setElectronicTicket(this);
			this.electronicTicketStateRecords.add(bean);
		}
		return this;
	}
	
	/** remove[ElectronicTicketPresentRecords] */
	public TB_ElectronicTicket removeElectronicTicketPresentRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord ... electronicTicketPresentRecords){
		if(this.electronicTicketPresentRecords == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord bean : electronicTicketPresentRecords){
			bean.setElectronicTicket(null);
			this.electronicTicketPresentRecords.remove(bean);
		}
		return this;
	}
	/** remove[ElectronicTicketStateRecords] */
	public TB_ElectronicTicket removeElectronicTicketStateRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord ... electronicTicketStateRecords){
		if(this.electronicTicketStateRecords == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord bean : electronicTicketStateRecords){
			bean.setElectronicTicket(null);
			this.electronicTicketStateRecords.remove(bean);
		}
		return this;
	}
	
	/**
	 * contains[ElectronicTicketPresentRecords]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsElectronicTicketPresentRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord ... electronicTicketPresentRecords){
		if(this.electronicTicketPresentRecords == null || electronicTicketPresentRecords==null || electronicTicketPresentRecords.length<=0){
			return false;
		}
		return this.electronicTicketPresentRecords.containsAll(java.util.Arrays.asList(electronicTicketPresentRecords));
	}
	/**
	 * contains[ElectronicTicketStateRecords]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsElectronicTicketStateRecords(bairui.international.model.domain.jpa.TB_ElectronicTicketStateRecord ... electronicTicketStateRecords){
		if(this.electronicTicketStateRecords == null || electronicTicketStateRecords==null || electronicTicketStateRecords.length<=0){
			return false;
		}
		return this.electronicTicketStateRecords.containsAll(java.util.Arrays.asList(electronicTicketStateRecords));
	}
	

	/** take[电子券单] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder takeElectronicTicketOrder(){
		if(null == this.electronicTicketOrder){
			this.electronicTicketOrder = new bairui.international.model.domain.jpa.TB_ElectronicTicketOrder();
		}
		return this.electronicTicketOrder;
	}
	
	/** take[接受分配用户] */
	public bairui.international.model.domain.jpa.TB_User takeAssignedUser(){
		if(null == this.assignedUser){
			this.assignedUser = new bairui.international.model.domain.jpa.TB_User();
		}
		return this.assignedUser;
	}
	
	/** take[领取者] */
	public bairui.international.model.domain.jpa.TB_User takeTakor(){
		if(null == this.takor){
			this.takor = new bairui.international.model.domain.jpa.TB_User();
		}
		return this.takor;
	}
	
	/** take[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder takeProductOrder(){
		if(null == this.productOrder){
			this.productOrder = new bairui.international.model.domain.jpa.TB_ProductOrder();
		}
		return this.productOrder;
	}
	
	/** must[电子券单] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicketOrder mustElectronicTicketOrder() {
		return this.electronicTicketOrder;
	}
	
	/** optional[接受分配用户] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_User> optionalAssignedUser() {
		return java.util.Optional.ofNullable(this.assignedUser);
	}
	
	/** optional[领取者] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_User> optionalTakor() {
		return java.util.Optional.ofNullable(this.takor);
	}
	
	/** optional[产品订单] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_ProductOrder> optionalProductOrder() {
		return java.util.Optional.ofNullable(this.productOrder);
	}
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_ElectronicTicket other = (TB_ElectronicTicket) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}

	/**
	 * 状态相关
	 */
	public bairui.international.model.status.State_ElectronicTicket state(){
		return this.getState();
	}


}
